from django.test import TestCase
from django.test.client import Client

"""
Testira index stranu koja ispisuje tabelu sa poenima. Test je prost, samo se ulogujemo i odemo
na stranu. Ocekujemo podatke iz initial_data.json.
"""
class IndexTestCase(TestCase):
    # ovako mozemo da uvalimo dodatne usere, meceve...
    #fixtures = ['additional_users']
    
    def setUp(self):
        pass

    def runTest(self):
        c = Client()
        c.login(username='kokan', password='123')
        
        response = c.get("/mdcs/")
        self.failIf(response == None)
        self.failIf(response.context == None)
        self.failUnlessEqual(len(response.context), 5)
        
        self.failIf(response.context[0]["news"] == None)
        news = response.context[0]["news"]
        self.failUnlessEqual(len(news.object_list), 2)